﻿using System;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Gean.Configuring.CoderSetting;
using Pansoft.HIME.Controllers;
using Pansoft.HIME.Manager;

namespace Pansoft.HIME.Site
{
    public class WebApiApplication : HttpApplication
    {
        private static readonly string[] _CorderSettingFile = new[]
        {
            "MainOption"
        };

        protected void Application_Start()
        {
            Paths.CoderSettingFile.Check(_CorderSettingFile, new string[] { });
            CoderSettingXmlFile[] fileList = CoderSettingService.GetOptionFiles();
            CoderSettingService.ME.Initializes(fileList);

            var logger = NLog.LogManager.GetCurrentClassLogger();
            logger.Info("项目选项初始化完成。");

            AttributeRoutingHttp.RegisterRoutes(GlobalConfiguration.Configuration.Routes);
            AreaRegistration.RegisterAllAreas();
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

        }
    }
}